UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ATa2SPb1Agqn2JNYoEifuC0SjpNurYvH6KSJV9KV/aw=' 
WHERE 
  key_id = 'de4ff247a2f0222f133becb3895eba350dc4e93269b2c93f86606956e5434fac' 
  AND (
    token = 'ATa2SPb1Agqn2JNYoEifuC0SjpNurYvH6KSJV9KV/aw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041