UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yR7lGW5N3oksNTCXGyPH+CSUt1W2qcnYe9+oTlcJG5Q=' 
WHERE 
  key_id = 'e6e24ea591d90c9d43e4c0f254ad33b2c22804d381e1a26ef514ab57b1ce4c86' 
  AND (
    token = 'yR7lGW5N3oksNTCXGyPH+CSUt1W2qcnYe9+oTlcJG5Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049