UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w8QAc2Vw9QKsJM0TLeKuZq1+HCQNGc0t+lbXMG8aZfA=' 
WHERE 
  key_id = 'b475a4650a8882d56bef47d58ab5d57bd83036aaf3cddda9aad8a8241a5a2b71' 
  AND (
    token = 'w8QAc2Vw9QKsJM0TLeKuZq1+HCQNGc0t+lbXMG8aZfA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054