UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LuWWFh1BMclndsMJuCMETnwySwU2oaGTf4nEErVm0SA=' 
WHERE 
  key_id = '81f5ca45d98cdb9d3a873e961c756f8e16061f3533345ad28a5adda121f6b17b' 
  AND (
    token = 'LuWWFh1BMclndsMJuCMETnwySwU2oaGTf4nEErVm0SA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028