UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dEFTRPpfN92k/B7lUFrAasW8dGPhkz69HjQyczNzCu8=' 
WHERE 
  key_id = '3a2cdd144af4dd5f597dfd84316d1e9a269c121a736569c786b2e749c09d4782' 
  AND (
    token = 'dEFTRPpfN92k/B7lUFrAasW8dGPhkz69HjQyczNzCu8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052