UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'amZ5QTy9VPD3jaKtLNcUdtOKebdK4D7koowdWqeWKr8=' 
WHERE 
  key_id = '40555b2e5350c4482150b69264e9b45c84a847b2b7dcd05d767782670d9b5b54' 
  AND (
    token = 'amZ5QTy9VPD3jaKtLNcUdtOKebdK4D7koowdWqeWKr8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028