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

Query time 0.00022