UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5ySA/57NB7WIUw+8rg7+6clRDVahqzjZ1LtfDwLqJfs=' 
WHERE 
  key_id = '39815988df03bff604e3bb85e466a1ccd6534830abf20d30de48f2c3ab815fc5' 
  AND (
    token = '5ySA/57NB7WIUw+8rg7+6clRDVahqzjZ1LtfDwLqJfs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036