UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QoHOPFbHBHRnNp4znGFlR7mQr3igcJyQ5108QEptNw8=' 
WHERE 
  key_id = 'feccdf8b73a37a34165b163ba36137f5e8e5e3d1b7fdfea6c0680867f697e6a5' 
  AND (
    token = 'QoHOPFbHBHRnNp4znGFlR7mQr3igcJyQ5108QEptNw8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020