UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jRCiR4ZXd7oy8g+3kgJ4K820vcELyMYzL7oyDd9AF1s=' 
WHERE 
  key_id = 'a679188b373628c6f4b06db4bedd0450291e372cffee1e94946397e9cb58fa2a' 
  AND (
    token = 'jRCiR4ZXd7oy8g+3kgJ4K820vcELyMYzL7oyDd9AF1s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043