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

Query time 0.00023