UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fPC2G619whIiVE7M7H5nuFudnpjkyyWMU5pCNUdh7Sg=' 
WHERE 
  key_id = '65e840ddf21fb12848ad395b80569389893af38344988615401133ee9c8d3a48' 
  AND (
    token = 'fPC2G619whIiVE7M7H5nuFudnpjkyyWMU5pCNUdh7Sg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032