UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OnBZeUb9xNEtDlxldvgI8RNGCjIZUSea759DzEKA6NM=' 
WHERE 
  key_id = '5284144d4678260ed999d8cbedd74d77ccb2ee75ef396f55feaf779fec668c7e' 
  AND (
    token = 'OnBZeUb9xNEtDlxldvgI8RNGCjIZUSea759DzEKA6NM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024