UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QjnZKcX0FrQrT1og5XH6E+fx53ccRyIIwDQT+4wrxGI=' 
WHERE 
  key_id = '8b52bac158975dc2c6e3caa4b4317adc361dd1fbc786374fa59c51ce03f50d39' 
  AND (
    token = 'QjnZKcX0FrQrT1og5XH6E+fx53ccRyIIwDQT+4wrxGI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038