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

Query time 0.00042