UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wkDf3ks50gEe+BjtaSg1+5r4TQ5QJpsyuK+jNFed9JQ=' 
WHERE 
  key_id = '0d82f292ef9b89a86825705b0351cee54894600e18390ed8ab057f5d2237fce2' 
  AND (
    token = 'wkDf3ks50gEe+BjtaSg1+5r4TQ5QJpsyuK+jNFed9JQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042