UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kmP1wCvAfBeY9SYOWVfXbB5DlwQTK6UaQxQL6rkB1VM=' 
WHERE 
  key_id = '712456c088c7406770a4e95225da2c851abf6477c8cca253119ea464c20be899' 
  AND (
    token = 'kmP1wCvAfBeY9SYOWVfXbB5DlwQTK6UaQxQL6rkB1VM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016