UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tKzSoHX4wHRJiOuJbVHHkzDdTd2mQcstiBlb+lsxqdk=' 
WHERE 
  key_id = 'ddabc6e1d65809fb130918531c2fc85f45926e9a33779f2e845e4bdfdcc1a30c' 
  AND (
    token = 'tKzSoHX4wHRJiOuJbVHHkzDdTd2mQcstiBlb+lsxqdk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030