UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3K6p+K3IWax/qvv/pYzaJMrv9OPpQ6VHteTInKZ/Xcg=' 
WHERE 
  key_id = 'd12ffb051e05bc22866cfa923388a5003e43165e2f6bee0fe2c1ec52b13bb88a' 
  AND (
    token = '3K6p+K3IWax/qvv/pYzaJMrv9OPpQ6VHteTInKZ/Xcg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031