UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YStxkNXotVBcQx4uqkD+sKpI42J0TMtd0+SZxxb91Gg=' 
WHERE 
  key_id = 'b92da28565324a80192159f2eb596b63e80ca430307eb80fc08c36fc1a72150f' 
  AND (
    token = 'YStxkNXotVBcQx4uqkD+sKpI42J0TMtd0+SZxxb91Gg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036