UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HidUduZ8Eso5rvvdcEWqxztDn81BsAzgjLF7bHVutgU=' 
WHERE 
  key_id = 'aad598f157e66da64ca24fc26b4074b5b0c7a754b383ecf4a93de9ac7c8af984' 
  AND (
    token = 'HidUduZ8Eso5rvvdcEWqxztDn81BsAzgjLF7bHVutgU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036