UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NFS+c/UUcVm7QNBOcSzgDWXtIlIPsyZ2SAIReWZnzIc=' 
WHERE 
  key_id = 'e7284fe076136595f55b476d5b63fb88d4f7e3c631297dde48c617f92083e655' 
  AND (
    token = 'NFS+c/UUcVm7QNBOcSzgDWXtIlIPsyZ2SAIReWZnzIc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045