UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZKQhd3e+XDcnjKlUvHNwFqOX9pp3HWNqmPligEY3lZw=' 
WHERE 
  key_id = 'b4d357320b0f09ac329a29da0a63ef2bd155688f751e83990bb452fbd1d7aa4b' 
  AND (
    token = 'ZKQhd3e+XDcnjKlUvHNwFqOX9pp3HWNqmPligEY3lZw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047