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

Query time 0.00056