UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZBKZkLvRnjZ00Vc3E1yWH07dEeQc3d58elXr1qaG55A=' 
WHERE 
  key_id = '8d9a753a92180db2534b286129273785349b160a03ebf28279a1c2bef45f509e' 
  AND (
    token = 'ZBKZkLvRnjZ00Vc3E1yWH07dEeQc3d58elXr1qaG55A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036