UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lKltYB+MqY7U8D8k1lfiMXQSoZb0XX21GdL1Z1kx6pQ=' 
WHERE 
  key_id = '70b2de4dfe6bf2698acf25b57c6d7ab11db8757d76a79cbf85c3449ea6e4a834' 
  AND (
    token = 'lKltYB+MqY7U8D8k1lfiMXQSoZb0XX21GdL1Z1kx6pQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025