UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U+g8h7zXcQbJYmR/QGtngP3iUTNy3ik9FGTKBZ/o/fQ=' 
WHERE 
  key_id = '3aa02c2cd34c0f181609e9e485c8c3f95b787cab65e56a8e60ac622a75f4b934' 
  AND (
    token = 'U+g8h7zXcQbJYmR/QGtngP3iUTNy3ik9FGTKBZ/o/fQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050