UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HjN4LtMGijmY50bON2DRse3LURimLeLcaRiv2wTztSM=' 
WHERE 
  key_id = '8160a713489999bc9c7cca4244bd585060ee329c8a24b38b053a0cdf8ae1d0bd' 
  AND (
    token = 'HjN4LtMGijmY50bON2DRse3LURimLeLcaRiv2wTztSM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040