UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QfbRIed6YF6uCi0MNe4J068bd/OD/7K/74oHqFuCiLI=' 
WHERE 
  key_id = '5052216c519cc0618e56e47a908dd0747baaf8f6b8354bc665c831dc7630cddc' 
  AND (
    token = 'QfbRIed6YF6uCi0MNe4J068bd/OD/7K/74oHqFuCiLI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025