UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c+UMMngCMPjs0C0yTqPn2vtIboJlbi6KjBhh7Y68PEY=' 
WHERE 
  key_id = '28fcc3f5ff8b77e7a95fb3c6d5829e36c7318b5b697e4ccdfad69988cdd247b9' 
  AND (
    token = 'c+UMMngCMPjs0C0yTqPn2vtIboJlbi6KjBhh7Y68PEY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023