UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lpGdDs/KrYiRKocJrijgdrkNsn5avIgSB2vE8PYveRw=' 
WHERE 
  key_id = '4077fc3a0fd375ff3522baa8232536d5031a9f5339d0ccf23d72b591afa1ebd7' 
  AND (
    token = 'lpGdDs/KrYiRKocJrijgdrkNsn5avIgSB2vE8PYveRw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040